473,416 Members | 1,685 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,416 software developers and data experts.

Table with div submenu

HDI
Hi,

I've got a table and when a user moves over a row I want to show a div
with a submenu.

The code is ok but when I move over a row he sets the top and left to
the mousepoitners top and left (event.clientX and event.clientY).

How can I put the div(submenu) to the top of the row and the right
side.

Thx

Jun 7 '06 #1
3 4218
Hi,

You can use those functions to find the position X and Y on most
browsers of an element:
function findPosX(obj) {
var curleft = 0;
if(obj.offsetParent)
while(1)
{
curleft += obj.offsetLeft;
if(!obj.offsetParent)
break;
obj = obj.offsetParent;
}
else if(obj.x)
curleft += obj.x;
return curleft;
}

function findPosY(obj) {
var curtop = 0;
if(obj.offsetParent)
while(1)
{
curtop += obj.offsetTop;
if(!obj.offsetParent)
break;
obj = obj.offsetParent;
}
else if(obj.y)
curtop += obj.y;
return curtop;
}
obj is the row of the table in your case, and do a simple calculation
to get the most right part of the row.
cheers..

HDI wrote:
Hi,

I've got a table and when a user moves over a row I want to show a div
with a submenu.

The code is ok but when I move over a row he sets the top and left to
the mousepoitners top and left (event.clientX and event.clientY).

How can I put the div(submenu) to the top of the row and the right
side.

Thx


Jun 7 '06 #2
HDI

Leandro Ardissone schreef:
Hi,

You can use those functions to find the position X and Y on most
browsers of an element:
function findPosX(obj) {
var curleft = 0;
if(obj.offsetParent)
while(1)
{
curleft += obj.offsetLeft;
if(!obj.offsetParent)
break;
obj = obj.offsetParent;
}
else if(obj.x)
curleft += obj.x;
return curleft;
}

function findPosY(obj) {
var curtop = 0;
if(obj.offsetParent)
while(1)
{
curtop += obj.offsetTop;
if(!obj.offsetParent)
break;
obj = obj.offsetParent;
}
else if(obj.y)
curtop += obj.y;
return curtop;
}
obj is the row of the table in your case, and do a simple calculation
to get the most right part of the row.
cheers..

How do I pass that row?

Y = findPosY(???)

Jun 8 '06 #3

HDI wrote:
Leandro Ardissone schreef:
Hi,

You can use those functions to find the position X and Y on most
browsers of an element:
function findPosX(obj) {
var curleft = 0;
if(obj.offsetParent)
while(1)
{
curleft += obj.offsetLeft;
if(!obj.offsetParent)
break;
obj = obj.offsetParent;
}
else if(obj.x)
curleft += obj.x;
return curleft;
}

function findPosY(obj) {
var curtop = 0;
if(obj.offsetParent)
while(1)
{
curtop += obj.offsetTop;
if(!obj.offsetParent)
break;
obj = obj.offsetParent;
}
else if(obj.y)
curtop += obj.y;
return curtop;
}
obj is the row of the table in your case, and do a simple calculation
to get the most right part of the row.
cheers..

How do I pass that row?

Y = findPosY(???)

The argument of findPosY is the parent item..

something like:
Y = findPosY(document.getElementById('row').firstChild ());

Jun 8 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Benoit | last post by:
Here is a quick view of what my program is doing: I am using a system hook to add a menu inside the system menu of my Internet Explorer. Everything seems to work fine for now , my submenu is...
1
by: Tom | last post by:
This is for AccessXP I goto View - Toolbars - Customize and am able to brong up the Customize dialog for my custom menu. I can click on a menu item to select it and the blackbox appears around...
0
by: chofra03 | last post by:
Hi, I'm using the following code to create my own menu within Visual Studio ..NET. Therefore, I would like to be able to add submenu but could not find any explanation on how to do it. ...
0
by: jeff.perreault | last post by:
I have a problem with a skmMenu submenu and I think it has to do with an IIS Setting. I have the same website set up on two servers - One is MS 2003, the other is MS 2003 R2 If I load the web...
5
by: Jonathan | last post by:
Hello All, I am in the process of creating a 2/3 level collapsible/exspanible menu (called "nav") where users can click on a category and have the submenus appear beneath it and so on (allow...
0
Denburt
by: Denburt | last post by:
This code is for a Toggle Button layout on a form, with this code you can set a number of toggle buttons visible and have multiple submenus that will stay hidden when not in use. My main menu is set...
2
by: az538 | last post by:
Hello All, I am having a problem with my menu and submenu system. It works like a champ in IE6 and Firefox but IE7 renders the submenus in incorrect positions on the page. Also, the menu system...
1
by: bhosalevivek | last post by:
I did this code from Dynamic Drive DHTML. it's working properly, but now I need submenu for "Submenu 1.2", means when I take mouse on "Submenu 1.2" I need to display "Submenu 1.2.1". I try to do...
1
oll3i
by: oll3i | last post by:
i have written css tab menu but my links in submenu inherit the style of a href in main menu (#menu ul li a)? when i hover over the links in submenu they do change as i want them to change they...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.